1000
It is possible to search for an item ( inside the Editor ), case insensitive

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('DropDownList') as EXGRIDLib.Column).Editor do
	begin
		EditType := EXGRIDLib.EditTypeEnum.DropDownListType;
		AddItem(1,'One',Nil);
		AddItem(2,'Two',Nil);
		AddItem(3,'Three',Nil);
	end;
	with Items do
	begin
		AddItem(AxGrid1.Columns.Item[TObject(0)].Editor.FindItem['>ONE']);
		AddItem(AxGrid1.Columns.Item[TObject(0)].Editor.FindItem['>ThRee']);
		AddItem(AxGrid1.Columns.Item[TObject(0)].Editor.FindItem['ONE']);
		AddItem(AxGrid1.Columns.Item[TObject(0)].Editor.FindItem['>tWo']);
	end;
	EndUpdate();
end
999
The text after the BR-tag is in same line as the text before the BR-tag (entire column)

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exHLines;
	with (Columns.Add('Default') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
		Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
	end;
	with Items do
	begin
		AddItem('This is the first line.<br>This is the second line.');
		AddItem('This is the first line.<br>This is the second line.');
		AddItem('This is the first line.<br>This is the second line.');
	end;
	EndUpdate();
end
998
The text after the BR-tag is in same line as the text before the BR-tag (individual)

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exHLines;
	Columns.Add('Default');
	with Items do
	begin
		CellValueFormat[TObject(AddItem('This is the first line.<br>This is the second line.')),TObject(0)] := EXGRIDLib.ValueFormatEnum.exHTML;
		h := AddItem('<b>This is the first line.<br>This is the second line.</b>');
		CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exHTML;
		CellSingleLine[TObject(h),TObject(0)] := EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap;
		CellValueFormat[TObject(AddItem('This is the first line.<br>This is the second line.')),TObject(0)] := EXGRIDLib.ValueFormatEnum.exHTML;
	end;
	EndUpdate();
end
997
Can I disable an item once the user selects a new value into a different item

// Change event - Occurs when the user changes the cell's content.
procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			EnableItem[ItemByIndex[1]] := False;
		end;
	end
end;

with AxGrid1 do
begin
	FreezeEvents(True);
	BeginUpdate();
	ScrollBySingleLine := True;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	Columns.Add('Q');
	Columns.Add('A');
	with Items do
	begin
		h1 := AddItem('What''s your gender?');
		with CellEditor[TObject(h1),TObject(1)] do
		begin
			EditType := EXGRIDLib.EditTypeEnum.DropDownListType;
			AddItem(1,'Male',Nil);
			AddItem(0,'Female',Nil);
		end;
		CellValue[TObject(h1),TObject(1)] := TObject(1);
		h2 := AddItem('What''s pet name?');
		CellValue[TObject(h2),TObject(1)] := 'This is my pet favorite long long long name, that shoul break the line in multiple pieces';
		CellSingleLine[TObject(h2),TObject(1)] := EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap;
	end;
	EndUpdate();
	FreezeEvents(False);
end
996
How can I get a row expanded / enlarged to fit the cell's text (entire column)

with AxGrid1 do
begin
	BeginUpdate();
	ScrollBySingleLine := True;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	Columns.Add('Q');
	with (Columns.Add('A') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
		with Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.MemoType;
			Appearance := EXGRIDLib.InplaceAppearanceEnum.SingleApp;
		end;
	end;
	with Items do
	begin
		h1 := AddItem('What''s name?');
		CellValue[TObject(h1),TObject(1)] := 'This is my pet favorite long long long name, that shoul break the line in multiple pieces';
		h2 := AddItem('What''s your pet name?');
		CellValue[TObject(h2),TObject(1)] := 'This is my pet favorite long long long name, that shoul break the line in multiple pieces';
	end;
	EndUpdate();
end
995
How can I get a row expanded / enlarged to fit the cell's text (individual cell)

with AxGrid1 do
begin
	BeginUpdate();
	ScrollBySingleLine := True;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	Columns.Add('Q');
	Columns.Add('A');
	with Items do
	begin
		h1 := AddItem('What''s name?');
		CellValue[TObject(h1),TObject(1)] := 'This is my pet favorite long long long name, that shoul break the line in multiple pieces';
		h2 := AddItem('What''s your pet name?');
		with CellEditor[TObject(h2),TObject(1)] do
		begin
			EditType := EXGRIDLib.EditTypeEnum.MemoType;
			Appearance := EXGRIDLib.InplaceAppearanceEnum.SingleApp;
		end;
		CellValue[TObject(h2),TObject(1)] := 'This is my pet favorite long long long name, that shoul break the line in multiple pieces';
		CellSingleLine[TObject(h2),TObject(1)] := EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap;
	end;
	EndUpdate();
end
994
InsertControlItem / UserEditor / A2X:

with AxGrid1 do
begin
	BeginUpdate();
	BackColor := Color.FromArgb(240,240,240);
	ConditionalFormats.Add('1 = 1',Nil).Bold := True;
	(Columns.Add('Type') as EXGRIDLib.Column).Alignment := EXGRIDLib.AlignmentEnum.RightAlignment;
	with Items do
	begin
		h := AddItem('1. A ProgID such as "MSCAL.Calendar.7"');
		ItemDivider[h] := 0;
		hX := InsertControlItem(0,'MSCAL.Calendar','');
		(ItemObject[hX] as MSACAL.Calendar).BackColor := $ffffff;
		h := AddItem('2. A CLSID such as "{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}"');
		ItemDivider[h] := 0;
		hX := InsertControlItem(0,'{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}','');
		h := AddItem('3. A URL such as "http://www.exontrol.com"');
		ItemDivider[h] := 0;
		hX := InsertControlItem(0,'http://www.exontrol.com','');
		h := AddItem('4. A reference to an Active document such as "file://\\Documents\MyDoc.doc"');
		ItemDivider[h] := 0;
		hX := InsertControlItem(0,'file://C:\empesting.xml','');
		h := AddItem('5.A fragment of HTML such as "MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>"');
		ItemDivider[h] := 0;
		hX := InsertControlItem(0,'MSHTML:<HTML><BODY>This is a <b>line of</b> text</BODY></HTML>','');
		ItemHeight[hX] := 56;
		h := AddItem('6.Anything, if it is preffixed by "A2X:"');
		ItemDivider[h] := 0;
		hX := InsertControlItem(0,'A2X:TOC24.Toc24Ctrl.1','');
	end;
	EndUpdate();
end
993
How do I add a RichTextBox editor
// UserEditorOleEvent event - Occurs when an user editor fires an event.
procedure TWinForm1.AxGrid1_UserEditorOleEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent);
begin
	with AxGrid1 do
	begin
		OutputDebugString( e.ev );
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	DefaultItemHeight := 32;
	with (Columns.Add('RICHTEXT') as EXGRIDLib.Column).Editor do
	begin
		EditType := EXGRIDLib.EditTypeEnum.UserEditorType;
		UserEditor('RICHTEXT.RichtextCtrl','');
		with (UserEditorObject as RichTextLib.RichTextBox) do
		begin
			AutoVerbMenu := True;
			TextRTF := '{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard\r\nThis is some {\b bold} text.\par\r\n}';
		end;
	end;
	with Items do
	begin
		AddItem('RICHTEXT.RichtextCtrl');
	end;
	EndUpdate();
end
992
Is it possible to trap a double-click event on a specific cell and when that happens, to set the cell to a specific value
// DblClick event - Occurs when the user dblclk the left mouse button over an object.
procedure TWinForm1.AxGrid1_DblClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_DblClickEvent);
begin
	with AxGrid1 do
	begin
		h := get_ItemFromPoint(-1,-1,c,hit);
		OutputDebugString( Items.CellValue[TObject(h),TObject(c)] );
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HeaderAppearance := EXGRIDLib.AppearanceEnum.Etched;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	Columns.Add('C1');
	Columns.Add('C2');
	with Items do
	begin
		CellValue[TObject(AddItem('Item 1')),TObject(1)] := 'Item 2';
		CellValue[TObject(AddItem('Item 3')),TObject(1)] := 'Item 4';
		CellValue[TObject(AddItem('Item 5')),TObject(1)] := 'Item 6';
	end;
	EndUpdate();
end
991
How can I display dates in DD/MM/YYYY format

with AxGrid1 do
begin
	BeginUpdate();
	ScrollBySingleLine := False;
	Columns.Add('Date');
	with Items do
	begin
		ItemDivider[AddItem('Different Date Formats')] := 0;
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := '((shortdateF(value) mid 4) left 2) + `/` + (shortdateF (value) left 2) + `/` + (shortdateF (value) right 4)';
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := '(1 array (0:=(shortdateF(value) split `/`))) + `/` + (0 array (=:0) ) + `/` + (2 array (=:0) )';
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := '((`0` + day(value) ) right 2) + `/` + ((`0` + month(value) ) right 2) + `/` + year(value)';
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := 'day(value) + `/` + month(value) + `/` + year(value)';
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := 'year(value) + ` - ` + day(value) + ` - ` + month(value)';
		h := AddItem('12/1/1971');
		ItemHeight[h] := 24;
		CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exHTML;
		FormatCell[TObject(h),TObject(0)] := '`<b>` + year(value) + `</b><off -4> ` + day(value) + ` - ` + month(value)';
		ItemDivider[AddItem('Predefined Date Formats')] := 0;
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := 'value';
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := 'shortdateF(value)';
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := 'shortdate(value)';
		FormatCell[TObject(AddItem('12/1/1971')),TObject(0)] := 'longdate(value)';
	end;
	EndUpdate();
end
990
I have noticed that the column gets resized once I release the mouse. I have a column that displays multiple-lines cells, and the text gets wrapped only when user releases the mouse. Is it possible to get resized contiguously as I had before
with AxGrid1 do
begin
	BeginUpdate();
	ScrollBySingleLine := False;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exVLines;
	ColumnsAllowSizing := True;
	(Columns.Add('Column A (cont)') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exColumnResizeContiguously] := TObject(True);
	Columns.Add('Column 1');
	(Columns.Add('Column B (cont)') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exColumnResizeContiguously] := TObject(True);
	Columns.Add('Column 2');
	EndUpdate();
end
989
How do I get the column from cursor, when it hovers the empty portion of the items section
// MouseMove event - Occurs when the user moves the mouse.
procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent);
begin
	with AxGrid1 do
	begin
		i := get_ItemFromPoint(0,-1,c,hit);
		OutputDebugString( 'Column' );
		OutputDebugString( c );
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exVLines;
	Columns.Add('Column 0');
	Columns.Add('Column 1');
	Columns.Add('Column 2');
	EndUpdate();
end
988
How do I add items once the user clicks the empty area
// Click event - Occurs when the user presses and then releases the left mouse button over the grid control.
procedure TWinForm1.AxGrid1_ClickEvent(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		i := get_ItemFromPoint(0,-1,c,hit);
		with Items do
		begin
			CellValue[TObject(AddItem(TObject(i))),TObject(1)] := TObject(c);
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	Columns.Add('Number of Items to Add');
	Columns.Add('Click on Column');
	EndUpdate();
end
987
Is there any option to stop events
// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent);
begin
	with AxGrid1 do
	begin
		OutputDebugString( 'AddItem event is fired only if FreezeEvents(False) is called' );
	end
end;

with AxGrid1 do
begin
	FreezeEvents(True);
	BeginUpdate();
	DefaultItemHeight := 24;
	Columns.Add('Task');
	with Items do
	begin
		h1 := AddItem('Task 1');
		h2 := AddItem('Task 2');
	end;
	EndUpdate();
	FreezeEvents(False);
end
986
How can I include the child items, when a filter is applied

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := True;
	ContinueColumnScroll := False;
	MarkSearchColumn := False;
	SearchColumnIndex := 1;
	Indent := 16;
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible;
	FilterBarPromptPattern := 'Nancy';
	FilterInclude := EXGRIDLib.FilterIncludeEnum.exItemsWithChilds;
	with Columns do
	begin
		(Add('Name') as EXGRIDLib.Column).Width := 96;
		(Add('Title') as EXGRIDLib.Column).Width := 96;
		Add('City');
	end;
	with Items do
	begin
		h0 := AddItem('Nancy Davolio');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'Seattle';
		h0 := InsertItem(h0,Nil,'Andrew Fuller');
		CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales';
		CellValue[TObject(h0),TObject(2)] := 'Tacoma';
		h0 := InsertItem(h0,Nil,'Michael Suyama');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'London';
		h0 := AddItem('Janet Leverling');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'Kirkland';
		h0 := InsertItem(h0,Nil,'Margaret Peacock');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'Redmond';
		ExpandItem[0] := True;
	end;
	ApplyFilter();
	EndUpdate();
end
985
How do I prevent changing the cell's state ( check-box state )
// CellStateChanging event - Fired before cell's state is about to be changed.
procedure TWinForm1.AxGrid1_CellStateChanging(sender: System.Object; e: AxEXGRIDLib._IGridEvents_CellStateChangingEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			e.newState := CellState[TObject(e.item),TObject(e.colIndex)];
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	with (Columns.Add('P1') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
	end;
	with (Columns.Add('P2') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		ExpandItem[h] := True;
	end;
	EndUpdate();
end
984
How do I get sorted the column as string, numeric, date, date and time. Also how can it be applied to drop down filter panel

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('Date') as EXGRIDLib.Column) do
	begin
		SortType := EXGRIDLib.SortTypeEnum.SortDate;
		DisplayFilterButton := True;
		DisplayFilterPattern := False;
		DisplayFilterDate := True;
		FilterList := Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox) Or Integer(EXGRIDLib.FilterListEnum.exSortItemsDesc);
	end;
	with (Columns.Add('DateTime') as EXGRIDLib.Column) do
	begin
		SortType := EXGRIDLib.SortTypeEnum.SortDateTime;
		DisplayFilterButton := True;
		DisplayFilterPattern := False;
		FilterList := Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox) Or Integer(EXGRIDLib.FilterListEnum.exSortItemsDesc);
	end;
	with (Columns.Add('Time') as EXGRIDLib.Column) do
	begin
		SortType := EXGRIDLib.SortTypeEnum.SortTime;
		DisplayFilterButton := True;
		DisplayFilterPattern := False;
		FilterList := Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox) Or Integer(EXGRIDLib.FilterListEnum.exSortItemsDesc);
		FormatColumn := 'time(value)';
	end;
	with (Columns.Add('Numeric') as EXGRIDLib.Column) do
	begin
		SortType := EXGRIDLib.SortTypeEnum.SortNumeric;
		DisplayFilterButton := True;
		FilterList := Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox) Or Integer(EXGRIDLib.FilterListEnum.exSortItemsDesc);
	end;
	with (Columns.Add('String') as EXGRIDLib.Column) do
	begin
		DisplayFilterButton := True;
		FilterList := Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox) Or Integer(EXGRIDLib.FilterListEnum.exSortItemsDesc);
	end;
	with Items do
	begin
		h := AddItem('1/27/2010');
		CellValue[TObject(h),TObject(1)] := '1/27/2010 10:00:00 AM';
		CellValue[TObject(h),TObject(2)] := CellValue[TObject(h),TObject(1)];
		CellValue[TObject(h),TObject(3)] := TObject(1);
		CellValue[TObject(h),TObject(4)] := CellValue[TObject(h),TObject(3)];
		h := AddItem('1/27/2011');
		CellValue[TObject(h),TObject(1)] := '1/27/2011 9:00:00 AM';
		CellValue[TObject(h),TObject(2)] := CellValue[TObject(h),TObject(1)];
		CellValue[TObject(h),TObject(3)] := TObject(11);
		CellValue[TObject(h),TObject(4)] := CellValue[TObject(h),TObject(3)];
		h := AddItem('11/2/2010');
		CellValue[TObject(h),TObject(1)] := '11/2/2010 9:00:00 AM';
		CellValue[TObject(h),TObject(2)] := CellValue[TObject(h),TObject(1)];
		CellValue[TObject(h),TObject(3)] := TObject(2);
		CellValue[TObject(h),TObject(4)] := CellValue[TObject(h),TObject(3)];
	end;
	Columns.Item['DateTime'].DisplayFilterDate := False;
	EndUpdate();
end
983
I am using Layout property to sort multiple columns at once. The problem is that all items get expanded. How do I prevent that

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	with (Columns.Add('P1') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
	end;
	with (Columns.Add('P2') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
		FormatColumn := '1 index ``';
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,Nil,'Child A');
		InsertItem(h,Nil,'Child B');
		InsertItem(h,Nil,'Child A');
		InsertItem(h,Nil,'Child B');
		AddItem('Root');
		AddItem('Root');
	end;
	SingleSort := False;
	Layout := 'multiplesort="C0:1 C1:2";collapse=""';
	EndUpdate();
end
982
How do I find the cell's type, or what the cell holds

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	with Columns do
	begin
		(Add('Value') as EXGRIDLib.Column).Width := 24;
		(Add('Type') as EXGRIDLib.Column).FormatColumn := 'type(%0)';
		(Add('TypeAsString') as EXGRIDLib.Column).FormatColumn := '(0 := type(%0)) array (`empty`, `null`, `short`, `long`, `float`, `double`, `currency`, `date`, `string`, `object`, `error`, `bo' + 
	'olean`, `variant`, `any`, `reserved`, `decimal`, `char`, `byte`, `unsigned short`, `unsigned long`, `long on 64 bits`)';
		(Add('Length') as EXGRIDLib.Column).FormatColumn := 'len(%0)';
	end;
	with Items do
	begin
		AddItem(Nil);
		AddItem('');
		CellValue[TObject(.AddItem(Nil)),TObject(0)] := (AxGrid1.GetOcx() as EXGRIDLib.Grid);
		CellValue[TObject(AddItem(Nil)),TObject(0)] := TObject(True);
		CellValue[TObject(AddItem(Nil)),TObject(0)] := TObject(-1);
		CellValue[TObject(AddItem(Nil)),TObject(0)] := TObject(-1);
		CellValue[TObject(AddItem(Nil)),TObject(0)] := '1/1/2001';
	end;
	EndUpdate();
end
981
How can I get ride / hide the image being dragged by OLE Drag and Drop
// OLEStartDrag event - Occurs when the OLEDrag method is called.
procedure TWinForm1.AxGrid1_OLEStartDrag(sender: System.Object; e: AxEXGRIDLib._IGridEvents_OLEStartDragEvent);
begin
	// Data.SetData("data to drag")
	with AxGrid1 do
	begin
		e.allowedEffects := 1;
	end
end;

with AxGrid1 do
begin
	OLEDropMode := EXGRIDLib.exOLEDropModeEnum.exOLEDropManual;
	set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropAfter,$ffffff);
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	Columns.Add('Default');
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		ExpandItem[h] := True;
	end;
end
980
The ReadOnly property does not prevent changing the column's check-box (sample 2)

with AxGrid1 do
begin
	BeginUpdate();
	ShowFocusRect := False;
	with (Columns.Add('C1') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		Width := 18;
		Editor.EditType := EXGRIDLib.EditTypeEnum.CheckValueType;
	end;
	Columns.Add('C2');
	with Items do
	begin
		CellValue[TObject(AddItem(TObject(0))),TObject(1)] := 'Item 1';
		CellValue[TObject(AddItem(TObject(-1))),TObject(1)] := 'Item 2';
		CellValue[TObject(AddItem(TObject(0))),TObject(1)] := 'Item 3';
	end;
	ReadOnly := EXGRIDLib.ReadOnlyEnum.exReadOnly;
	Columns.Item[TObject(0)].Editor.Option[EXGRIDLib.EditorOptionEnum.exCheckValue2] := TObject(2);
	EndUpdate();
end
979
The ReadOnly property does not prevent changing the column's check-box (sample 1)

with AxGrid1 do
begin
	BeginUpdate();
	ShowFocusRect := False;
	with (Columns.Add('C1') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		Width := 18;
		with Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.CheckValueType;
			Option[EXGRIDLib.EditorOptionEnum.exCheckValue2] := TObject(1);
		end;
	end;
	Columns.Add('C2');
	with Items do
	begin
		CellValue[TObject(AddItem(TObject(0))),TObject(1)] := 'Item 1';
		CellValue[TObject(AddItem(TObject(-1))),TObject(1)] := 'Item 2';
		CellValue[TObject(AddItem(TObject(0))),TObject(1)] := 'Item 3';
	end;
	ReadOnly := EXGRIDLib.ReadOnlyEnum.exReadOnly;
	EndUpdate();
end
978
How can I export checked items only

with AxGrid1 do
begin
	BeginUpdate();
	with Columns do
	begin
		(Add('C1') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		(Add('C2') as EXGRIDLib.Column).FormatColumn := '1 index `A-Z`';
		(Add('C3') as EXGRIDLib.Column).FormatColumn := '100 index ``';
	end;
	with Items do
	begin
		AddItem('Item 1');
		CellState[TObject(AddItem('Item 2')),Nil] := 1;
		CellState[TObject(AddItem('Item 3')),Nil] := 1;
	end;
	EndUpdate();
	OutputDebugString( 'Export CSV Checked Items Only:' );
	OutputDebugString( Export('','chk') );
end
977
How can I export a hidden column

with AxGrid1 do
begin
	BeginUpdate();
	with Columns do
	begin
		Add('C1');
		with (Add('C2') as EXGRIDLib.Column) do
		begin
			FormatColumn := '1 index `A-Z`';
			Visible := False;
		end;
		with (Add('C3') as EXGRIDLib.Column) do
		begin
			FormatColumn := '100 index ``';
			Visible := False;
		end;
	end;
	with Items do
	begin
		AddItem('Item 1');
		AddItem('Item 2');
		AddItem('Item 3');
	end;
	EndUpdate();
	OutputDebugString( 'Export CSV Hidden Columns (1,2):' );
	OutputDebugString( Export('','|1,2') );
end
976
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 3)

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	AutoDrag := EXGRIDLib.AutoDragEnum.exAutoDragPositionAny;
	HasLines := EXGRIDLib.HierarchyLineEnum.exSolidLine;
	Indent := 16;
	MarkSearchColumn := False;
	with Columns do
	begin
		with (Add('') as EXGRIDLib.Column) do
		begin
			Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
			FormatColumn := '((1:=(0 :=(1 rpos ''.|A-Z||a-z|'')) rfind `.`) < 0 ? `<b>` + =:0 + `` :  (=:0 mid (1 + 1 + =:1) )  + `)` ) + ` ` + value';
		end;
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,Nil,'Child');
		hChild := InsertItem(h,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(h,Nil,'Child');
		ExpandItem[0] := True;
		h := AddItem('Root');
		InsertItem(h,Nil,'Child');
		hChild := InsertItem(h,Nil,'Child');
		CellState[TObject(hChild),TObject(0)] := 1;
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(h,Nil,'Child');
	end;
	EndUpdate();
end
975
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 2)

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	GridLineColor := Color.FromArgb(190,190,190);
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	AutoDrag := EXGRIDLib.AutoDragEnum.exAutoDragPositionAny;
	HasLines := EXGRIDLib.HierarchyLineEnum.exSolidLine;
	Indent := 16;
	with Columns do
	begin
		Add('Default');
		with (Add('') as EXGRIDLib.Column) do
		begin
			Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
			Def[EXGRIDLib.DefColumnEnum.exCellPaddingRight] := TObject(4);
			AllowSizing := False;
			Width := 36;
			Position := 0;
			FormatColumn := '(1:=(0 :=(1 rpos ''.|A-Z||a-z|'')) rfind `.`) < 0 ? `<b>` + =:0 : (`............` left 2 * (=:0 count `.`)) + (=:0 mid (1 + 1 + =:' + 
	'1) ) ';
		end;
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,Nil,'Child');
		hChild := InsertItem(h,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(h,Nil,'Child');
		ExpandItem[0] := True;
		h := AddItem('Root');
		InsertItem(h,Nil,'Child');
		hChild := InsertItem(h,Nil,'Child');
		CellState[TObject(hChild),TObject(0)] := 1;
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(h,Nil,'Child');
	end;
	EndUpdate();
end
974
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 1)

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	AutoDrag := EXGRIDLib.AutoDragEnum.exAutoDragPositionAny;
	HasLines := EXGRIDLib.HierarchyLineEnum.exSolidLine;
	Indent := 16;
	with Columns do
	begin
		Add('Default');
		with (Add('') as EXGRIDLib.Column) do
		begin
			Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
			Def[EXGRIDLib.DefColumnEnum.exCellPaddingRight] := TObject(4);
			Alignment := EXGRIDLib.AlignmentEnum.RightAlignment;
			AllowSizing := False;
			Width := 24;
			Position := 0;
			FormatColumn := '(1:=(0 :=(1 rpos ''.|A-Z||a-z|'')) rfind `.`) < 0 ? `<b>` + =:0 : `<i>` + (=:0 mid (1 + 1 + =:1) ) ';
		end;
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,Nil,'Child');
		hChild := InsertItem(h,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(h,Nil,'Child');
		ExpandItem[0] := True;
		h := AddItem('Root');
		InsertItem(h,Nil,'Child');
		hChild := InsertItem(h,Nil,'Child');
		CellState[TObject(hChild),TObject(0)] := 1;
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(hChild,Nil,'Child');
		InsertItem(h,Nil,'Child');
	end;
	EndUpdate();
end
973
How can I programmatically group by columns, without having the control's sort bar visible

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SortBarHeight := 0;
	SortBarVisible := True;
	SortBarCaption := 'Drag a <b>column</b> header here to group by that column.';
	AllowGroupBy := True;
	Layout := 'multiplesort="C1:2"';
	EndUpdate();
end
972
How do I perform my own sort

// Sort event - Fired when the control sorts a column.
procedure TWinForm1.AxGrid1_Sort(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		OutputDebugString( 'Sort' );
		with Items do
		begin
			ItemPosition[ItemByIndex[1]] := 0;
			ItemPosition[ItemByIndex[0]] := 1;
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	SingleSort := False;
	SortOnClick := EXGRIDLib.SortOnClickEnum.exUserSort;
	with Columns do
	begin
		(Add('Index') as EXGRIDLib.Column).FormatColumn := '0 index ``';
		Add('Data 1');
		Add('Data 2');
	end;
	with Items do
	begin
		h := AddItem(TObject(0));
		CellValue[TObject(h),TObject(1)] := TObject(2);
		CellValue[TObject(h),TObject(2)] := TObject(3);
		h := AddItem(TObject(4));
		CellValue[TObject(h),TObject(1)] := TObject(5);
		CellValue[TObject(h),TObject(2)] := TObject(6);
		h := AddItem(TObject(7));
		CellValue[TObject(h),TObject(1)] := TObject(8);
		CellValue[TObject(h),TObject(2)] := TObject(9);
	end;
	Layout := 'multiplesort="C1:1 C2:2"';
	EndUpdate();
end
971
Is it possible to have a different alignment for parts of the cell's caption

with AxGrid1 do
begin
	BeginUpdate();
	TreeColumnIndex := -1;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	with (Columns.Add('Default') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
	end;
	with Items do
	begin
		CellHAlignment[TObject(AddItem('all-left')),TObject(0)] := EXGRIDLib.AlignmentEnum.LeftAlignment;
		CellHAlignment[TObject(AddItem('all-center')),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment;
		CellHAlignment[TObject(AddItem('all-right')),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment;
		h := AddItem('left<c>center<r>right');
		CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exHTML;
	end;
	EndUpdate();
end
970
I have a column with Def(exCellSingleLine) property on False, word-wrapping, and I am wondering if possible to update the column's content while user is resizing it
with AxGrid1 do
begin
	BeginUpdate();
	with Columns do
	begin
		with (Add('MultipleLine') as EXGRIDLib.Column) do
		begin
			Width := 32;
			Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
			Def[EXGRIDLib.DefColumnEnum.exColumnResizeContiguously] := TObject(True);
		end;
		with (Add('SingleLine') as EXGRIDLib.Column) do
		begin
			Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
		end;
	end;
	with Items do
	begin
		CellValue[TObject(AddItem('This is a bit of long text that should break the line')),TObject(1)] := 'This is a bit of long text that should break the line';
	end;
	EndUpdate();
end
969
How can I get the absolute position of an item
// MouseMove event - Occurs when the user moves the mouse.
procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			OutputDebugString( CellCaption[TObject(AxGrid1.ItemFromPoint[-1,-1,c,hit]),'Position'] );
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	BackColorAlternate := Color.FromArgb(240,240,240);
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	(Columns.Add('Def') as EXGRIDLib.Column).DisplayFilterButton := True;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(InsertItem(h,Nil,'Child 1'),Nil,'Sub-Child 1');
		InsertItem(InsertItem(h,Nil,'Child 2'),Nil,'Sub-Child 2');
	end;
	PutItems(GetItems(TObject(-1)),Nil);
	PutItems(GetItems(TObject(-1)),Nil);
	PutItems(GetItems(TObject(-1)),Nil);
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '1 apos ``';
		Visible := False;
	end;
	EndUpdate();
end
968
I am using ExComboBox as an user editor, how can I display a different column

// UserEditorClose event - Fired the user editor is about to be opened.
procedure TWinForm1.AxGrid1_UserEditorClose(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorCloseEvent);
begin
	// Items.CellValue(Item,ColIndex) = Object.Value
end;

// UserEditorOleEvent event - Occurs when an user editor fires an event.
procedure TWinForm1.AxGrid1_UserEditorOleEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent);
begin
	with AxGrid1 do
	begin
		OutputDebugString( e.ev );
	end
end;

// UserEditorOpen event - Occurs when an user editor is about to be opened.
procedure TWinForm1.AxGrid1_UserEditorOpen(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorOpenEvent);
begin
	// Object.Value = Me.Items.CellValue(Item,ColIndex)
end;

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('Exontrol.ComboBox') as EXGRIDLib.Column).Editor do
	begin
		EditType := EXGRIDLib.EditTypeEnum.UserEditorType;
		UserEditor('Exontrol.ComboBox','');
		with UserEditorObject do
		begin
		end;
	end;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	DefaultItemHeight := 21;
	with Items do
	begin
		CellEditorVisible[TObject(AddItem(TObject(10248))),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible;
		CellEditorVisible[TObject(AddItem(TObject(10249))),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible;
		CellEditorVisible[TObject(AddItem(TObject(10250))),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible;
	end;
	EndUpdate();
end
967
How do I sort the index column as numeric (Method 3)

// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			CellData[TObject(e.item),TObject(1)] := TObject(CellCaption[TObject(e.item),TObject(1)]);
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	ColumnAutoResize := True;
	ShowFocusRect := False;
	with (Columns.Add('Next') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellPaddingLeft] := TObject(4);
		Def[EXGRIDLib.DefColumnEnum.exHeaderPaddingLeft] := TObject(4);
	end;
	with (Columns.Add('Index') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		Width := 48;
		FormatColumn := '(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)';
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
		SortType := EXGRIDLib.SortTypeEnum.SortUserData;
		Position := 0;
	end;
	with Items do
	begin
		AddItem('Item 1');
		AddItem('Item 2');
		AddItem('Item 3');
		AddItem('Item 4');
		AddItem('Item 5');
		AddItem('Item 6');
		AddItem('Item 7');
		AddItem('Item 8');
		AddItem('Item 9');
		AddItem('Item 10');
	end;
	EndUpdate();
end
966
How do I sort the index column as numeric (Method 2)

// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			CellSortData[TObject(e.item),TObject(1)] := TObject(CellCaption[TObject(e.item),TObject(1)]);
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	ColumnAutoResize := True;
	ShowFocusRect := False;
	with (Columns.Add('Next') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellPaddingLeft] := TObject(4);
		Def[EXGRIDLib.DefColumnEnum.exHeaderPaddingLeft] := TObject(4);
	end;
	with (Columns.Add('Index') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		Width := 48;
		FormatColumn := '(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)';
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
		SortType := EXGRIDLib.SortTypeEnum.SortCellData;
		Position := 0;
	end;
	with Items do
	begin
		AddItem('Item 1');
		AddItem('Item 2');
		AddItem('Item 3');
		AddItem('Item 4');
		AddItem('Item 5');
		AddItem('Item 6');
		AddItem('Item 7');
		AddItem('Item 8');
		AddItem('Item 9');
		AddItem('Item 10');
	end;
	EndUpdate();
end
965
How do I sort the index column as numeric (Method 1)

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('Sort Index As String (Default)') as EXGRIDLib.Column) do
	begin
		FormatColumn := '1 index ``';
	end;
	with (Columns.Add('Sort Index As Numeric') as EXGRIDLib.Column) do
	begin
		ComputedField := '%C0';
		SortType := EXGRIDLib.SortTypeEnum.SortNumeric;
	end;
	with Items do
	begin
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
	end;
	EndUpdate();
end
964
How can I put icons/images into buttons

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := True;
	Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' + 
	'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' + 
	'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' + 
	'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=');
	with (Columns.Add('C+B') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		Width := 48;
		FormatColumn := '` <img>` + ( 1 + (1 index ``) mod 3 ) + `</img> `';
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellButtonAutoWidth] := TObject(True);
	end;
	Columns.Add('');
	DrawGridLines := EXGRIDLib.GridLinesEnum.exVLines;
	DefaultItemHeight := 20;
	with Items do
	begin
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
	end;
	EndUpdate();
end
963
Is it possible to have a CheckBox and Button TOGETHER on all cells in a column

// ButtonClick event - Occurs when user clicks on the cell's button.
procedure TWinForm1.AxGrid1_ButtonClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ButtonClickEvent);
begin
	with AxGrid1 do
	begin
		OutputDebugString( 'ButtonClick' );
		OutputDebugString( e.item );
		OutputDebugString( e.key );
	end
end;

// CellStateChanged event - Fired after cell's state has been changed.
procedure TWinForm1.AxGrid1_CellStateChanged(sender: System.Object; e: AxEXGRIDLib._IGridEvents_CellStateChangedEvent);
begin
	with AxGrid1 do
	begin
			OutputDebugString( 'CellStateChanged' );
		OutputDebugString( e.item );
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := True;
	with (Columns.Add('') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		Width := 32;
		FormatColumn := '1 index ``';
	end;
	with (Columns.Add('Def') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		Width := 48;
		FormatColumn := '`     `';
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellButtonAutoWidth] := TObject(True);
	end;
	Columns.Add('');
	with Items do
	begin
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
		AddItem('');
	end;
	EndUpdate();
end
962
I have columns that look up the same data. (e.g. different contact) so both could / should use the same editor. Is this possible, to use other column's editor

with AxGrid1 do
begin
	BeginUpdate();
	SelBackColor := BackColor;
	SelForeColor := ForeColor;
	with Columns do
	begin
		with (Add('Pos') as EXGRIDLib.Column) do
		begin
			Width := 32;
			AllowSizing := False;
			FormatColumn := '1 index ``';
		end;
		var_Editor := Add('C1').Editor;
		with var_Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.ColorListType;
			ClearItems();
			AddItem(255,'Red Color',Nil);
			AddItem(16711680,'Blue Color',Nil);
			AddItem(65280,'Green Color',Nil);
		end;
		(Add('C2') as EXGRIDLib.Column).Editor.EditType := Integer(EXGRIDLib.EditTypeEnum.CloneType) Or Integer(EXGRIDLib.EditTypeEnum.EditType);
		(Add('C3') as EXGRIDLib.Column).Editor.EditType := Integer(EXGRIDLib.EditTypeEnum.CloneType) Or Integer(EXGRIDLib.EditTypeEnum.EditType);
	end;
	with Items do
	begin
		h := AddItem('');
		CellValue[TObject(h),TObject(1)] := TObject(16711680);
		CellValue[TObject(h),TObject(2)] := TObject(65280);
		CellValue[TObject(h),TObject(3)] := TObject(255);
		h := AddItem('');
		CellValue[TObject(h),TObject(1)] := TObject(255);
		CellValue[TObject(h),TObject(2)] := TObject(16711680);
		CellValue[TObject(h),TObject(3)] := TObject(65280);
	end;
	EndUpdate();
end
961
Is there an easy way to get an effect like in a Microsoft Access / SQL-Server Table view, where you can scroll-up till the last row containing data is displayed as top-row

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	ScrollBars := Integer(EXGRIDLib.ScrollBarsEnum.exVScrollEmptySpace) Or Integer(EXGRIDLib.ScrollBarsEnum.exBoth);
	set_ScrollPos(True,Items.ItemCount);
	EndUpdate();
end
960
Does filtering work with umlauts / accents characters
with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('Names') as EXGRIDLib.Column) do
	begin
		DisplayFilterButton := True;
		FilterType := EXGRIDLib.FilterTypeEnum.exPattern;
	end;
	with Items do
	begin
		AddItem('Mantel');
		AddItem('Mechanik');
		AddItem('Motor');
		AddItem('Murks');
		AddItem('Märchen');
		AddItem('Möhren');
		AddItem('Mühle');
		AddItem('Sérigraphie');
	end;
	Columns.Item[TObject(0)].Filter := '*ä*';
	ApplyFilter();
	EndUpdate();
end
959
How FullPath method works

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	Columns.Add('C1');
	Columns.Add('C2');
	with Items do
	begin
		h := AddItem('Root');
		CellValue[TObject(h),TObject(1)] := 'A';
		CellValue[TObject(InsertItem(h,Nil,'Child 1')),TObject(1)] := 'B';
		CellValue[TObject(InsertItem(h,Nil,'Child 2')),TObject(1)] := 'C';
		ExpandItem[h] := True;
	end;
	SearchColumnIndex := 1;
	OutputDebugString( SearchColumnIndex );
	OutputDebugString( Items.FullPath[.ItemByIndex[2]] );
	SearchColumnIndex := 0;
	OutputDebugString( SearchColumnIndex );
	OutputDebugString( Items.FullPath[.ItemByIndex[2]] );
	EndUpdate();
end
958
Can I set the search box / filterbarprompt to invisible, so I can use my own input and *string* via VBA
with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := True;
	ContinueColumnScroll := False;
	MarkSearchColumn := False;
	SearchColumnIndex := 1;
	FilterBarHeight := 0;
	FilterBarPromptVisible := EXGRIDLib.FilterBarVisibleEnum.exFilterBarPromptVisible;
	with Columns do
	begin
		(Add('Name') as EXGRIDLib.Column).Width := 96;
		(Add('Title') as EXGRIDLib.Column).Width := 96;
		Add('City');
	end;
	with Items do
	begin
		h0 := AddItem('Nancy Davolio');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'Seattle';
		h0 := AddItem('Andrew Fuller');
		CellValue[TObject(h0),TObject(1)] := 'Vice President, Sales';
		CellValue[TObject(h0),TObject(2)] := 'Tacoma';
		SelectItem[h0] := True;
		h0 := AddItem('Janet Leverling');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'Kirkland';
		h0 := AddItem('Margaret Peacock');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'Redmond';
		h0 := AddItem('Steven Buchanan');
		CellValue[TObject(h0),TObject(1)] := 'Sales Manager';
		CellValue[TObject(h0),TObject(2)] := 'London';
		h0 := AddItem('Michael Suyama');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'London';
		h0 := AddItem('Robert King');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'London';
		h0 := AddItem('Laura Callahan');
		CellValue[TObject(h0),TObject(1)] := 'Inside Sales Coordinator';
		CellValue[TObject(h0),TObject(2)] := 'Seattle';
		h0 := AddItem('Anne Dodsworth');
		CellValue[TObject(h0),TObject(1)] := 'Sales Representative';
		CellValue[TObject(h0),TObject(2)] := 'London';
	end;
	FilterBarPromptPattern := 'London';
	EndUpdate();
end
957
How to load a hierarchy using the control's DataSource property (Parent-ID-Relation)

// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			SetParent(e.item,FindItem[CellValue[TObject(e.item),'ReportsTo'],'EmployeeID',Nil]);
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	ColumnAutoResize := False;
	ContinueColumnScroll := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('SELECT * FROM Employees ORDER BY ReportsTo','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	Items.ExpandItem[0] := True;
	EndUpdate();
end
956
Is it possible to select the entire row/line, when user clicks the first column, and select individually the rest of cells, while user clicks any other column

// MouseDown event - Occurs when the user presses a mouse button.
procedure TWinForm1.AxGrid1_MouseDownEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseDownEvent);
begin
	with AxGrid1 do
	begin
		i := get_ItemFromPoint(-1,-1,c,hit);
		FullRowSelect := Columns.Item[TObject(c)].Data;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HeaderHeight := 22;
	HeaderAppearance := EXGRIDLib.AppearanceEnum.Flat;
	BackColorLock := Color.FromArgb(240,240,240);
	BackColorHeader := BackColorLock;
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	SortBarVisible := False;
	AllowGroupBy := True;
	ReadOnly := EXGRIDLib.ReadOnlyEnum.exReadOnly;
	ShowFocusRect := False;
	CountLockedColumns := 1;
	AutoDrag := EXGRIDLib.AutoDragEnum.exAutoDragScroll;
	SingleSort := False;
	ColumnsAllowSizing := True;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	GridLineStyle := EXGRIDLib.GridLinesStyleEnum.exGridLinesSolid;
	GridLineColor := Color.FromArgb(220,220,220);
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	Columns.Item[TObject(0)].Data := TObject(-1);
	Layout := 'singlesort="C5:1";multiplesort=" C1:2"';
	EndUpdate();
end
955
The user are not able to size the columns at runtime when using HeaderAppearance property on zero
with AxGrid1 do
begin
	VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABJEIQAAYAQGKIYBkAKBQAGaAoDDcMQ5QwAAyDGKEEwsACEIrjKCRShyCYZRhGcTSBCIZBqEqSZLiEZRQiiCYsS5GQBSFDcOwHGyQZonKK3Lh' + 
	'GCYBgIA=');
	HeaderAppearance := EXGRIDLib.AppearanceEnum($1000000);
	Columns.Add(1);
	Columns.Add(2);
	Columns.Add(3);
end
954
Is it possible to embed the exGauge into the exGrid control

// ItemOleEvent event - Fired when an ActiveX control hosted by an item has fired an event.
procedure TWinForm1.AxGrid1_ItemOleEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ItemOleEventEvent);
begin
	with AxGrid1 do
	begin
		with (Items.ItemObject[AxGrid1.Items.ItemByIndex[2]] as EXGAUGELib.Gauge) do
		begin
			v := FormatABC('date(`now`)',Nil,Nil,Nil);
			Layers.Item['sec'].Value := TObject(v);
			Layers.Item['min'].Value := TObject(v);
			Layers.Item['hour'].Value := TObject(v);
		end;
	end
end;

// MouseMove event - Occurs when the user moves the mouse.
procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent);
begin
	with AxGrid1 do
	begin
		with (Items.ItemObject[AxGrid1.Items.ItemByIndex[2]] as EXGAUGELib.Gauge) do
		begin
			TimerInterval := 1000;
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	ScrollBySingleLine := True;
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	HasLines := EXGRIDLib.HierarchyLineEnum.exThinLine;
	ScrollBySingleLine := True;
	Columns.Add('Default');
	with Items do
	begin
		h := AddItem('Normal Item');
		h := AddItem('Gauge-Clock Inside');
		ExpandItem[h] := True;
		h := InsertControlItem(h,'Exontrol.Gauge',Nil);
		ItemHeight[h] := 256;
		with (ItemObject[h] as EXGAUGELib.Gauge) do
		begin
			PicturesPath := 'C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Clock';
			DefaultLayer[185] := TObject(2);
			Layers.Count := 4;
			with Layers.Item[TObject(0)] do
			begin
				Background.Picture.Name := 'vista_clock.png';
			end;
			with Layers.Item[TObject(1)] do
			begin
				Position := 3;
				Key := 'sec';
				OnDrag := 2;
				Selectable := False;
				Background.Picture.Name := 'second-hand.png';
				ValueToRotateAngle := '((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 ))  - f' + 
	'loor(=:1)) * 60 )) - floor(=:2) ) * 360';
				RotateAngleToValue := 'value / 360 / 24 / 60';
			end;
			with Layers.Item[TObject(2)] do
			begin
				Position := 2;
				Key := 'min';
				OnDrag := 2;
				Selectable := False;
				Background.Picture.Name := 'Minute.png';
				ValueToRotateAngle := '((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 ))  - floor(=' + 
	':1)) * 360';
				RotateAngleToValue := 'value / 360 / 24 / 60';
			end;
			with Layers.Item[TObject(3)] do
			begin
				Position := 1;
				Key := 'hour';
				OnDrag := 2;
				Background.Picture.Name := 'Hour.png';
				ValueToRotateAngle := '2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )';
				RotateAngleToValue := 'value / 360 * 0.5';
			end;
			v := FormatABC('date(`now`)',Nil,Nil,Nil);
			Layers.Item['sec'].Value := TObject(v);
			Layers.Item['min'].Value := TObject(v);
			Layers.Item['hour'].Value := TObject(v);
		end;
		h := AddItem('Normal Item');
	end;
	EndUpdate();
end
953
What's the difference between merge cells and divider item

// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			CellBackColor[TObject(e.item),TObject(0)] := $f0f0f0;
			ItemHasChildren[e.item] := True;
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	TreeColumnIndex := 0;
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	(Columns.Add('C1') as EXGRIDLib.Column).FormatColumn := '1 index `A-Z`';
	(Columns.Add('C2') as EXGRIDLib.Column).FormatColumn := '1 index ``';
	(Columns.Add('C3') as EXGRIDLib.Column).FormatColumn := '1 index ``';
	with Items do
	begin
		AddItem(Nil);
		AddItem(Nil);
		h := AddItem(Nil);
		CellMerge[TObject(h),TObject(0)] := TObject(1);
		FormatCell[TObject(h),TObject(0)] := '`merge cells`';
		CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment;
		h := AddItem(Nil);
		ItemDivider[h] := 0;
		CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment;
		FormatCell[TObject(h),TObject(0)] := '`item divider`';
		AddItem(Nil);
		AddItem(Nil);
	end;
	EndUpdate();
end
952
is it possible to resize a column with the mouse without changing the width of the next column

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	(Columns.Add('Column 1') as EXGRIDLib.Column).Width := 256;
	(Columns.Add('Column 2') as EXGRIDLib.Column).Width := 512;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	EndUpdate();
end
951
How do I ensure that the newly item fits the control's client area

// ButtonClick event - Occurs when user clicks on the cell's button.
procedure TWinForm1.AxGrid1_ButtonClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ButtonClickEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			h := AddItem('');
			SelectItem[h] := True;
			EnsureVisibleItem(h);
		end;
		FocusColumnIndex := 0;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('') as EXGRIDLib.Column) do
	begin
		AllowSizing := False;
		AllowDragging := False;
		AllowSort := False;
		Width := 24;
		Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
	end;
	(Columns.Add('Position') as EXGRIDLib.Column).FormatColumn := '1 apos `A-Z`';
	CountLockedColumns := 1;
	with Items do
	begin
		AddItem('');
		AddItem('');
		AddItem('');
	end;
	EndUpdate();
end
950
How do I find the predefined string for giving value, or giving identifier for specified predefined caption of editor

// Change event - Occurs when the user changes the cell's content.
procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent);
begin
	with AxGrid1 do
	begin
		OutputDebugString( 'FindItem(numeric) is ' );
		OutputDebugString( e.newValue );
		OutputDebugString( Columns.Item[TObject(0)].Editor.FindItem[TObject(e.newValue)] );
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('DropDownList') as EXGRIDLib.Column) do
	begin
		with Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.DropDownListType;
			AddItem(1,'Ken Robinson',Nil);
			AddItem(2,'Dave Nichols',Nil);
			AddItem(3,'Zane Thomas',Nil);
			AddItem(4,'James Shields',Nil);
		end;
	end;
	with (Columns.Add('CellValue') as EXGRIDLib.Column) do
	begin
		FormatColumn := '%0';
		Def[EXGRIDLib.DefColumnEnum.exCellBackColor] := TObject(15790320);
		Def[EXGRIDLib.DefColumnEnum.exHeaderBackColor] := Def[EXGRIDLib.DefColumnEnum.exCellBackColor];
	end;
	with (Columns.Add('CellCaption') as EXGRIDLib.Column) do
	begin
		FormatColumn := '%C0';
		Def[EXGRIDLib.DefColumnEnum.exCellBackColor] := TObject(15790320);
		Def[EXGRIDLib.DefColumnEnum.exHeaderBackColor] := Def[EXGRIDLib.DefColumnEnum.exCellBackColor];
	end;
	with Items do
	begin
		AddItem(TObject(1));
		AddItem(AxGrid1.Columns.Item[TObject(0)].Editor.FindItem['Zane Thomas']);
		AddItem(TObject(2));
	end;
	EndUpdate();
end
949
How can I align captions of items with checkbox, with items with no checkbox

with AxGrid1 do
begin
	BeginUpdate();
	Columns.Add('Default');
	with Items do
	begin
		CellImages[TObject(AddItem(TObject(0))),TObject(0)] := '1';
		CellHasCheckBox[TObject(AddItem(TObject(1))),TObject(0)] := True;
		CellImages[TObject(AddItem(TObject(2))),TObject(0)] := '1';
	end;
	EndUpdate();
end
948
How can I prevent sorting a column

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	with (Columns.Add('Default') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
		AllowSort := False;
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		ExpandItem[h] := True;
	end;
	EndUpdate();
end
947
Is there a possibility to group without moving and showing the column to the SortBar

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SingleSort := False;
	SortBarVisible := False;
	AllowGroupBy := True;
	Layout := 'singlesort="C5:1";multiplesort=" C1:2"';
	EndUpdate();
end
946
How can I show each group header ( not-subroup ), with a different background color, while alternate background colors for inside items

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SingleSort := False;
	SortBarVisible := True;
	AllowGroupBy := True;
	Columns.Item[TObject(1)].SortOrder := True;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(0:= (1 rpos '''')) right ( ( 1:= ( =:0 rfind `.` ) ) != -1 ? =:1 : len(=:0))';
		Visible := False;
	end;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(1 rpos '''') contains ''.''';
		Visible := False;
	end;
	ConditionalFormats.Add('(%C13 mod 2) != 0',Nil).BackColor := $f0f0f0;
	ConditionalFormats.Add('%C14 = 0',Nil).BackColor := $bebebe;
	EndUpdate();
end
945
What is the difference between %0 and %C0, when using in expressions ( format, conditional format, computed fields, and so on )

with AxGrid1 do
begin
	BeginUpdate();
	HeaderAppearance := EXGRIDLib.AppearanceEnum.Etched;
	HeaderHeight := 24;
	ScrollBySingleLine := True;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	(Columns.Add('Value') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
	with (Columns.Add('FormatColumn = `%0` ~ CellValue') as EXGRIDLib.Column) do
	begin
		FormatColumn := '%0';
		Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
	end;
	with (Columns.Add('FormatColumn = `%C0`~ CellCaption') as EXGRIDLib.Column) do
	begin
		FormatColumn := '%C0';
		Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
	end;
	with Items do
	begin
		AddItem(TObject(1.1234));
		CellValueFormat[TObject(AddItem('<sha ;;0>This <fgcolor=FF0000>is a <s><b>HTM</fgcolor>L</b> text</s>.')),TObject(0)] := EXGRIDLib.ValueFormatEnum.exHTML;
		with CellEditor[TObject(AddItem(TObject(3))),Nil] do
		begin
			EditType := EXGRIDLib.EditTypeEnum.CheckListType;
			AddItem(1,'Border',Nil);
			AddItem(2,'Thick',Nil);
			AddItem(4,'Shadow',Nil);
		end;
		FormatCell[TObject(AddItem(TObject(10000))),TObject(0)] := '`<b>` + currency(value)';
	end;
	EndUpdate();
end
944
How can I alternate colors for each group header ( not-subroup ), with a different background color, while items of the same group showing with a different color

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SingleSort := False;
	SortBarVisible := True;
	AllowGroupBy := True;
	Columns.Item[TObject(1)].SortOrder := True;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(0:= (1 rpos '''')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))';
		Visible := False;
	end;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(1 rpos '''') contains ''.''';
		Visible := False;
	end;
	ConditionalFormats.Add('(%C13 mod 2) != 0',Nil).BackColor := $f0f0f0;
	ConditionalFormats.Add('%C14 = 0',Nil).BackColor := $bebebe;
	EndUpdate();
end
943
How can I highlight each group header, with a different background color (method 2)

// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddGroupItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddGroupItemEvent);
begin
	with AxGrid1 do
	begin
		Items.ItemBackColor[e.item] := $bebebe;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SingleSort := False;
	SortBarVisible := True;
	AllowGroupBy := True;
	Columns.Item[TObject(1)].SortOrder := True;
	EndUpdate();
end
942
How can I highlight each group header ( not-subroup ), with a different background color (method 1)

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SingleSort := False;
	SortBarVisible := True;
	AllowGroupBy := True;
	Columns.Item[TObject(1)].SortOrder := True;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(0:= (1 rpos '''')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))';
		Visible := False;
	end;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(1 rpos '''') contains ''.''';
		Visible := False;
	end;
	ConditionalFormats.Add('%C14 = 0',Nil).BackColor := $bebebe;
	EndUpdate();
end
941
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for each sub-tree, ConditionalFormats, Add

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

// Sort event - Fired when the control sorts a column.
procedure TWinForm1.AxGrid1_Sort(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	with (Columns.Add('P1') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
	end;
	with (Columns.Add('P2') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
	end;
	with Items do
	begin
		h := AddItem('Root 1');
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		ExpandItem[h] := True;
		h := AddItem('Root 2');
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		ExpandItem[h] := True;
		h := AddItem('Root 2');
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		ExpandItem[h] := True;
	end;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(0:= (1 rpos '''')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))';
		Visible := False;
	end;
	ConditionalFormats.Add('(%C2 mod 2) != 0',Nil).BackColor := $f0f0f0;
	EndUpdate();
end
940
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for 2nd, 3rd, 4th, row, and so on

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

// Sort event - Fired when the control sorts a column.
procedure TWinForm1.AxGrid1_Sort(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '1 apos ''''';
		Visible := False;
	end;
	ConditionalFormats.Add('(%C13 mod 5) = 1',Nil).BackColor := $808080;
	ConditionalFormats.Add('(%C13 mod 5) = 2',Nil).BackColor := $a4a4a4;
	ConditionalFormats.Add('(%C13 mod 5) = 3',Nil).BackColor := $bebebe;
	ConditionalFormats.Add('(%C13 mod 5) = 4',Nil).BackColor := $f0f0f0;
	EndUpdate();
end
939
The BackColorAlternate displays each second row with a different background color. The question I have it is possible to apply a different background color for 3rd, 4th, row, and so on

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

// Sort event - Fired when the control sorts a column.
procedure TWinForm1.AxGrid1_Sort(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '1 apos ''''';
		Visible := False;
	end;
	ConditionalFormats.Add('(%C13 mod 4) = 0',Nil).BackColor := $f0f0f0;
	EndUpdate();
end
938
The BackColorAlternate looks fine for flat tables, but how about using it when displaying a hierarchy/tree, like grouping rows. The sample alternate colors for each group found

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		Refresh();
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	HasLines := EXGRIDLib.HierarchyLineEnum.exNoLine;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SingleSort := False;
	SortBarVisible := True;
	AllowGroupBy := True;
	Columns.Item[TObject(1)].SortOrder := True;
	with (Columns.Add('Position') as EXGRIDLib.Column) do
	begin
		FormatColumn := '(0:= (1 rpos '''')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))';
		Visible := False;
	end;
	ConditionalFormats.Add('(%C13 mod 2) != 0',Nil).BackColor := $f0f0f0;
	EndUpdate();
end
937
I need to display sub-totals in the grouping items. Is there any solution on this

// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddGroupItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddGroupItemEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			ItemDivider[e.item] := -1;
			EnableItem[e.item] := False;
			CellValueFormat[TObject(e.item),TObject(AxGrid1.TreeColumnIndex)] := EXGRIDLib.ValueFormatEnum.exHTML;
			FormatCell[TObject(e.item),TObject(AxGrid1.TreeColumnIndex)] := '%1';
			CellValueFormat[TObject(e.item),'Freight'] := Integer(EXGRIDLib.ValueFormatEnum.exTotalField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML);
			CellValue[TObject(e.item),'Freight'] := 'sum(current,dir,%6)';
			FormatCell[TObject(e.item),'Freight'] := '`<b>` + currency(value)';
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	SelBackMode := EXGRIDLib.BackModeEnum.exTransparent;
	BackColorSortBar := Color.FromArgb(240,240,240);
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SortBarVisible := True;
	SortBarCaption := 'Drag a <b>column</b> header here to group by that column.';
	AllowGroupBy := True;
	Columns.Item[TObject(1)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending;
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exGroupLinesOutside;
	Columns.Item['ShipVia'].DisplayFilterButton := True;
	EndUpdate();
end
936
I use a subtotal in exTop-Item, after grouping the item shows 0. What is the solution

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SingleSort := False;
	AllowGroupBy := True;
	SortBarVisible := True;
	BackColorSortBar := BackColor;
	Columns.Item[TObject(5)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending;
	Columns.Item[TObject(6)].FormatColumn := 'currency(value)';
	with Items do
	begin
		LockedItemCount[EXGRIDLib.VAlignmentEnum.exTop] := 1;
		h := LockedItem[EXGRIDLib.VAlignmentEnum.exTop,0];
		ItemBackColor[h] := $f0f0f0;
		CellBackColor[TObject(h),TObject(6)] := $bebebe;
		CellValue[TObject(h),TObject(6)] := 'sum(all,rec,%6)';
		CellValueFormat[TObject(h),TObject(6)] := EXGRIDLib.ValueFormatEnum.exTotalField;
	end;
	Refresh();
	EndUpdate();
end
935
I would like to avoid manual typing in the date-cell because user often type wrong things (no decimal points and so on) and so the todays-date is generated for the cell. What can be done

// KeyPress event - Occurs when the user presses and releases an ANSI key.
procedure TWinForm1.AxGrid1_KeyPressEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_KeyPressEvent);
begin
	with AxGrid1 do
	begin
		OutputDebugString( 'if .Editying != 0 then' );
		OutputDebugString( Editing );
		e.keyAscii := 0;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	with Columns do
	begin
		Add('Tasks');
		with (Add('Date') as EXGRIDLib.Column) do
		begin
			Editor.EditType := EXGRIDLib.EditTypeEnum.DateType;
			Width := 128;
		end;
	end;
	with Items do
	begin
		CellValue[TObject(AddItem('Item 1')),TObject(1)] := '9/21/2006';
		CellValue[TObject(AddItem('Item 2')),TObject(1)] := '12/22/2015';
		CellValue[TObject(AddItem('Item 3')),TObject(1)] := '1/10/2015';
	end;
	EndUpdate();
end
934
The control does not ensure the item to fit the control's client area once the user clicks the cell's button or check box. What can be done
// MouseDown event - Occurs when the user presses a mouse button.
procedure TWinForm1.AxGrid1_MouseDownEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseDownEvent);
begin
	// Items.EnsureVisibleItem(ItemFromPoint(-1,-1,c,hit))
end;

with AxGrid1 do
begin
	BeginUpdate();
	TreeColumnIndex := -1;
	SelForeColor := ForeColor;
	with (Columns.Add('Buttons') as EXGRIDLib.Column) do
	begin
		Alignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
		Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
	end;
	with Items do
	begin
		AddItem('Button A');
		AddItem('Button B');
		AddItem('Button C');
	end;
	EndUpdate();
end
933
How do you save the index number from a drop down to a database

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	with Columns.Item['ShipVia'] do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellBackColor] := TObject(15790320);
		Position := 1;
		Width := 96;
		with Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.DropDownListType;
			AddItem(1,'Speedy Express',Nil);
			AddItem(2,'United Package',Nil);
			AddItem(3,'Federal Shipping',Nil);
		end;
	end;
	EndUpdate();
end
932
Is there a way to set the column width and have it stay when refreshing using the data source

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	Layout := 'gBjAAwAAuABmABpABsAB0ABlAByhoAPIAOEPAA9gYABoABQAgUEg0XN4AOcJicKkpujIAGMcj0gjcGk8QhkQgUOjUEjsfkMFAB2lEnhRihcYjUvnsykQAO8oMkTNEtGg' + 
	'AGUwn0uoEIhUMh0QiUOisXiE7rEyl8jAElokptYAllmpcCtMmjE3mU6jdzrUGoUKttGvFJs90oFPhVRh1Twg4wtaptco9fiMTsdIvcxw1Nkl2hUOlVwlsvnmayFAmtHn' + 
	'ETuWm0lAv+eAGCzFK10zp1QqVUAGOvkvuuSr0YsMUi2Y0tZ4FAztt0FvuNa23Kvt2m0YnMt5No6uxwOq0eP5cGxAAxQAxgAGwAqu/q1blHDsGW49lzPUq9qtko58r8Kr' + 
	'vc/LrPA7LWvw2ChpQ2j7Om7kBPK870hu+6ZQE4SJvmsT6u0x8BOa/iUP8jUANNATUrxAsKIFATvQU8DCL5B7dMWlr1u2gQZvgrsMMrDSyQ4vkcv02T+tEjUcyC1C7uw1' + 
	'kVABISgwSosXq1JLyRm9EaycqqDQuyjisu+0bvY5i3udEMjTIvkuQHFEmzHNkWymwcqtNNkIN2jUbMeGsdMm4j6R/AyZT7IcztC6M+r5Qs2yYvUx0ZOTZypBqBUZPEaM' + 
	'ax71y6+MeTBDdBoFTjjv2z80Oi9a+VJE9HSA01SUlBbw1Ww8sPSqtFNNCdOx3L9AuQx9eVLIlUJbCa+WHVrV0fYUEMBF06UqAFh0xLLCT7abHV7P8MuNQUnW3YlDuglr' + 
	'fNNcVlrzV6s3FWVKMfcVrPSq6rva0wcz8+Ue2/YK+XzQ0QUQlt83/JTr2ZdiZYBKNoTm2rH4ZedzSckqGDqAA2tEk7CSQmKEJKgWMY5CmQJlkaZYsAGMY0liFJYqKIDx' + 
	'hSpjCu0vUBQappOgSJZUhlBtTmyJIEqaBZVljRZe8yMZnoMl4SjQRI3qal3U7OjqPpOXNFmIAadCiHIkiDV6RjOla7puFKFnjK5/ta7Z6t6GIYkqEIQ1NmqWgIA=';
	EndUpdate();
end
931
Is it possible to decode/view the control's Layout property

with AxGrid1 do
begin
	BeginUpdate();
	SingleSort := False;
	Columns.Add('C0');
	(Columns.Add('C1') as EXGRIDLib.Column).SortOrder := EXGRIDLib.SortOrderEnum.SortAscending;
	Columns.Add('C2');
	with (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.Print')) as EXPRINTLib.Print) do
	begin
		OutputDebugString( Decode64TextW[AxGrid1.Layout] );
	end;
	EndUpdate();
end
930
How do I programmatically sort by multiple columns

with AxGrid1 do
begin
	BeginUpdate();
	SingleSort := False;
	Columns.Add('C0');
	Columns.Add('C1');
	Columns.Add('C2');
	Layout := 'multiplesort="C2:1 C1:2 C0:2"';
	EndUpdate();
end
929
Do you have any Fit-To-Page options when printing the control (W x T, Fit-To )

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	ContinueColumnScroll := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	EndUpdate();
	with (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.Print')) as EXPRINTLib.Print) do
	begin
		Options := 'FitToPage =2 x 1';
		PrintExt := (AxGrid1.GetOcx() as EXGRIDLib.Grid).DefaultDispatch;
		Preview();
	end;
end
928
Do you have any Fit-To-Page options when printing the control ( x T, Fit-To Tall )

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	ContinueColumnScroll := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	EndUpdate();
	with (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.Print')) as EXPRINTLib.Print) do
	begin
		Options := 'FitToPage = x 2';
		PrintExt := (AxGrid1.GetOcx() as EXGRIDLib.Grid).DefaultDispatch;
		Preview();
	end;
end
927
Do you have any Fit-To-Page options when printing the control ( W x, Fit-To Wide )

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	ContinueColumnScroll := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	EndUpdate();
	with (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.Print')) as EXPRINTLib.Print) do
	begin
		Options := 'FitToPage = 2 x';
		PrintExt := (AxGrid1.GetOcx() as EXGRIDLib.Grid).DefaultDispatch;
		Preview();
	end;
end
926
Do you have any Fit-To-Page options when printing the control ( percent view, Adjust-To )

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	ContinueColumnScroll := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	EndUpdate();
	with (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.Print')) as EXPRINTLib.Print) do
	begin
		Options := 'FitToPage = 50%';
		PrintExt := (AxGrid1.GetOcx() as EXGRIDLib.Grid).DefaultDispatch;
		Preview();
	end;
end
925
How can I get notified once the user expands a column

// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TWinForm1.AxGrid1_LayoutChanged(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		OutputDebugString( 'Column-Expanded' );
		OutputDebugString( Columns.Item['C0'].Expanded );
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	ShowFocusRect := False;
	ColumnAutoResize := False;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	BackColorLevelHeader := BackColor;
	with Columns do
	begin
		with (Add('C0') as EXGRIDLib.Column) do
		begin
			ExpandColumns := '0,1,2';
			DisplayExpandButton := True;
		end;
		Add('C1');
		Add('C2');
	end;
	with Items do
	begin
		h := AddItem('Cell 0.0');
		CellValue[TObject(h),TObject(1)] := 'Cell 0.1';
		CellValue[TObject(h),TObject(2)] := 'Cell 0.2';
		h := AddItem('Cell 1.0');
		CellValue[TObject(h),TObject(1)] := 'Cell 1.1';
		CellValue[TObject(h),TObject(2)] := 'Cell 1.2';
	end;
	EndUpdate();
end
924
I am using expandable headers, the question is how I can display the column itself, not just the child columns

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	BackColorLevelHeader := BackColor;
	with Columns do
	begin
		with (Add('C0') as EXGRIDLib.Column) do
		begin
			ExpandColumns := '0,1,2';
			DisplayExpandButton := True;
		end;
		Add('C1');
		Add('C2');
	end;
	with Items do
	begin
		h := AddItem('Cell 0.0');
		CellValue[TObject(h),TObject(1)] := 'Cell 0.1';
		CellValue[TObject(h),TObject(2)] := 'Cell 0.2';
		h := AddItem('Cell 1.0');
		CellValue[TObject(h),TObject(1)] := 'Cell 1.1';
		CellValue[TObject(h),TObject(2)] := 'Cell 1.2';
	end;
	EndUpdate();
end
923
How do I layout expandable columns

with AxGrid1 do
begin
	BeginUpdate();
	ColumnAutoResize := False;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines;
	BackColorLevelHeader := BackColor;
	with Columns do
	begin
		with (Add('C0') as EXGRIDLib.Column) do
		begin
			ExpandColumns := '1,2';
			DisplayExpandButton := True;
		end;
		Add('C1');
		Add('C2');
		Add('C3');
		with (Add('C4') as EXGRIDLib.Column) do
		begin
			ExpandColumns := '5,6';
			DisplayExpandButton := True;
		end;
		Add('C5');
		with (Add('C6') as EXGRIDLib.Column) do
		begin
			ExpandColumns := '6,7';
			DisplayExpandButton := True;
		end;
		Add('C7');
	end;
	EndUpdate();
	Columns.Item['C4'].Expanded := False;
end
922
How do I make the control read-only (method 2)

// Edit event - Occurs just before editing the focused cell.
procedure TWinForm1.AxGrid1_EditEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_EditEvent);
begin
	with AxGrid1 do
	begin
		e.cancel := True;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('Editor') as EXGRIDLib.Column).Editor do
	begin
		EditType := EXGRIDLib.EditTypeEnum.CheckListType;
		AddItem(1,'One',Nil);
		AddItem(2,'Two',Nil);
	end;
	with (Columns.Add('Check') as EXGRIDLib.Column) do
	begin
		with Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.CheckValueType;
			Option[EXGRIDLib.EditorOptionEnum.exCheckValue1] := TObject(2);
		end;
	end;
	with Items do
	begin
		CellValue[TObject(AddItem(TObject(1))),TObject(1)] := TObject(0);
		CellValue[TObject(AddItem(TObject(2))),TObject(1)] := TObject(1);
	end;
	EndUpdate();
end
921
How do I set a locked check-box

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('Locked-Check') as EXGRIDLib.Column) do
	begin
		with Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.CheckValueType;
			Option[EXGRIDLib.EditorOptionEnum.exCheckValue1] := TObject(2);
			Locked := True;
		end;
	end;
	with (Columns.Add('Unlocked-Check') as EXGRIDLib.Column) do
	begin
		with Editor do
		begin
			EditType := EXGRIDLib.EditTypeEnum.CheckValueType;
			Option[EXGRIDLib.EditorOptionEnum.exCheckValue2] := TObject(1);
		end;
	end;
	with Items do
	begin
		CellValue[TObject(AddItem(TObject(1))),TObject(1)] := TObject(0);
		CellValue[TObject(AddItem(TObject(0))),TObject(1)] := TObject(1);
	end;
	EndUpdate();
end
920
Does the title of the cell's tooltip supports HTML format

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('') as EXGRIDLib.Column) do
	begin
		Caption := '';
		HTMLCaption := 'Column';
	end;
	with Items do
	begin
		CellToolTip[TObject(AddItem('tooltip w/h different title')),TObject(0)] := '<c><b><fgcolor=FF0000>Title</fgcolor></b><br>This is bit of text that''s shown when the user hovers the cell. This shows the titl' + 
	'e centered with a different color.';
	end;
	EndUpdate();
end
919
How do I specify a different title for the cell's tooltip

with AxGrid1 do
begin
	BeginUpdate();
	with (Columns.Add('') as EXGRIDLib.Column) do
	begin
		Caption := 'This is the title';
		HTMLCaption := 'Column';
	end;
	with Items do
	begin
		CellToolTip[TObject(AddItem('tooltip w/h different title')),TObject(0)] := 'This is bit of text that''s shown when the user hovers the cell.';
	end;
	EndUpdate();
end
918
The cell's tooltip displays the column's caption in its title. How can I get ride of that

with AxGrid1 do
begin
	BeginUpdate();
	with Columns do
	begin
		Add('C1');
		Add('C2');
	end;
	with Items do
	begin
		h := AddItem('tooltip w/h caption');
		CellToolTip[TObject(h),TObject(0)] := 'This is bit of text that''s shown when the user hovers the cell. This shows the column''s caption in the title.';
		CellValue[TObject(h),TObject(1)] := 'tooltip no caption';
		CellToolTip[TObject(h),TObject(1)] := 'This is bit of text that''s shown when the user hovers the cell. This shows no column''s caption in the title.';
	end;
	with Columns.Item['C2'] do
	begin
		HTMLCaption := Caption;
		Caption := '';
	end;
	EndUpdate();
end
917
How can I programmatically show the column's filter

// RClick event - Fired when right mouse button is clicked
procedure TWinForm1.AxGrid1_RClick(sender: System.Object; e: System.EventArgs);
begin
	with AxGrid1 do
	begin
		i := get_ItemFromPoint(-1,-1,c,hit);
		Columns.Item[TObject(c)].ShowFilter('-1,-1,128,128');
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	ShowFocusRect := False;
	with (Columns.Add('Items ') as EXGRIDLib.Column) do
	begin
		DisplayFilterPattern := False;
		FilterList := Integer(EXGRIDLib.FilterListEnum.exShowExclude) Or Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox);
	end;
	with Items do
	begin
		AddItem('Item 1');
		AddItem('Item 2');
		AddItem('Item 3');
	end;
	EndUpdate();
end
916
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 2)

// ColumnClick event - Fired after the user clicks on column's header.
procedure TWinForm1.AxGrid1_ColumnClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ColumnClickEvent);
begin
	// Column.SortOrder = 1
	with AxGrid1 do
	begin
		SortOnClick := EXGRIDLib.SortOnClickEnum.exDefaultSort;
		Columns.Item['Sort'].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending;
		SortOnClick := EXGRIDLib.SortOnClickEnum.exUserSort;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	SortOnClick := EXGRIDLib.SortOnClickEnum.exUserSort;
	Columns.Add('Items');
	(Columns.Add('Sort') as EXGRIDLib.Column).Visible := False;
	with Items do
	begin
		CellValue[TObject(AddItem('Item 1 (3)')),TObject(1)] := TObject(3);
		CellValue[TObject(AddItem('Item 2 (1)')),TObject(1)] := TObject(1);
		CellValue[TObject(AddItem('Item 3 (2)')),TObject(1)] := TObject(2);
	end;
	EndUpdate();
end
915
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 1)

// ColumnClick event - Fired after the user clicks on column's header.
procedure TWinForm1.AxGrid1_ColumnClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ColumnClickEvent);
begin
	// Column.SortOrder = 1
	with AxGrid1 do
	begin
		Items.SortChildren(0,'Sort',True);
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	SortOnClick := EXGRIDLib.SortOnClickEnum.exUserSort;
	Columns.Add('Items');
	(Columns.Add('Sort') as EXGRIDLib.Column).Visible := False;
	with Items do
	begin
		CellValue[TObject(AddItem('Item 1 (3)')),TObject(1)] := TObject(3);
		CellValue[TObject(AddItem('Item 2 (1)')),TObject(1)] := TObject(1);
		CellValue[TObject(AddItem('Item 3 (2)')),TObject(1)] := TObject(2);
	end;
	EndUpdate();
end
914
How can I highlight the cell's button with a different appearance, when cursor hovers it

with AxGrid1 do
begin
	BeginUpdate();
	VisualAppearance.Add(1,'c:\exontrol\images\normal.ebn');
	DefaultItemHeight := 22;
	TreeColumnIndex := -1;
	SelForeColor := Color.FromArgb(0,0,0);
	SelBackColor := BackColor;
	set_Background(EXGRIDLib.BackgroundPartEnum.exCursorHoverCellButton,$1000000);
	with (Columns.Add('Buttons') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
		Alignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
		HeaderAlignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
	end;
	with Items do
	begin
		AddItem('Button <b>1</b>');
		AddItem('Button <b>2</b>');
		AddItem('Button <b>3</b>');
	end;
	EndUpdate();
end
913
How can I prevent highlighting the cell's button while cursor hovers it

// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			CellValue[TObject(e.item),TObject(0)] := 'Button <b>A</b>';
			CellValue[TObject(e.item),TObject(1)] := 'Button <b>B</b>';
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	DefaultItemHeight := 22;
	TreeColumnIndex := -1;
	SelForeColor := Color.FromArgb(0,0,0);
	SelBackColor := BackColor;
	set_Background(EXGRIDLib.BackgroundPartEnum.exCursorHoverCellButton,$ffffffff);
	with (Columns.Add('A') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
		Alignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
		HeaderAlignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
	end;
	with (Columns.Add('B') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
		Alignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
		HeaderAlignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
	end;
	(Columns.Add('') as EXGRIDLib.Column).Position := 1;
	with Items do
	begin
		CellEnabled[TObject(AddItem('')),TObject(1)] := False;
		AddItem('');
		AddItem('');
	end;
	EndUpdate();
end
912
How can I change the image of the icon while performing OLE Drag and Drop

// OLEStartDrag event - Occurs when the OLEDrag method is called.
procedure TWinForm1.AxGrid1_OLEStartDrag(sender: System.Object; e: AxEXGRIDLib._IGridEvents_OLEStartDragEvent);
begin
	// Data.SetData("your data to drag")
	with AxGrid1 do
	begin
		e.allowedEffects := 2;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	OLEDropMode := EXGRIDLib.exOLEDropModeEnum.exOLEDropManual;
	ColumnAutoResize := False;
	DefaultItemHeight := 22;
	HeaderHeight := DefaultItemHeight;
	(Columns.Add('Default') as EXGRIDLib.Column).Width := 128;
	with Items do
	begin
		AddItem('Item 1');
		AddItem('Item 2');
		AddItem('Item 3');
		AddItem('Item 4');
		AddItem('Item 5');
	end;
	with VisualAppearance do
	begin
		Add(1,'gBFLBCJwBAEHhEJAAChABakMACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziYBYfgkMIgSbJUgDGAkRRdDSOYDmGQYDiCIoRShOMIjHL' + 
	'UXxtDaIZwhEAoJb+RgAUY/cTzaAEUwHHiTKInaCQIhsC4JUJAdRURQ9EwvCIZBpEWwLChENQwWLCNj2TScBwjCyqbale45ViqdoDU8lORLUi+M4zSBPcZVTRtGShPDBK' + 
	'TjMLaYgkIIlVpRNa0PC1GTzQ6mazkKQLRADDIDVbAeL3LiMBy9LyLLItQALByua5mWhbcZyBCOPgBTrRb5zO58FjuTK7YLjMB7NrUNYtFaUMy2OpOCADIaecTNcaWLxP' + 
	'F2MY1HWYxVj2Jw3DuRJonKYB5lKAYkkYdA6hyDIjBkApaFoAAhBMfYxiGNAkFECZnm4YQBgiOgDl2URSE4KAEj2AJKigFgGgGYIIAyPQ6CCRogAAOxhAMSgSDgIRDhYF' + 
	'oFmGCBmBQOAMjgdgQDsUITEIIg5iISAEmIOBigiJgqgqYhoFyVILyyMgyDmYxDg4rBjgiZg6g0Dh4kiTIMGMKAwmgOQkEkFhGhGZIJAoPoQAyQ4mE6BhlAkRgXhODoZC' + 
	'0A4Pg6KRmCSFplkkdheDmJYTioVgACOY4uGaDwmgmJhqg8JlWmOGRmGkChyhyZxJAobYbmMI4yHqFQnkmdh+2RYp4DMIZ5gaBohmiCYGB+IJOmoNhtiPXZGG2I1tgyb4' + 
	'lmgGhmhqJt0Fyb4gk8CtsCiahKhYH4oXiAohiUKpKjaLt+goDJxiyaZqlaNot4OTJx3gKp2iiL5sAsBoov+KgMnOMZrisJpKjLjocnPeBLEaRI0m0SxWkSNBPEoDJ1ja' + 
	'bJrHaXo35obOZC2OximaOZugsYpi3ga42mKO5vAuRpijsTxqAyd49m8S5mnqPuqFyd4gk+DAGn6QJwEwFp+kAT+BnmQpwgwNwOkPtYsnnrgsFcEpFnGDBnBKRRPiwUwc' + 
	'kecgMgcIpHGMKQwnuSZygyJ1/HKOgMnyS5zAyRwykycw5g4Eg0jCA57DqTpzkydw+kIDR9AUCY9A2HQXBIUh0g0JRJ5aUxmnQZIPnkUgvDUI5tFcVoPjUOB+A4QBAICA' + 
	'');
		Add(2,'gBFLBCJwBAEHhEJAAChABC8MACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziaQIRDINQlSTJcQjKKEUQTFiXIyAKKwEgmEQMQiCcbzXI' + 
	'UBxAAqXZZFUaKAgOMJDTLBAzUTCQbR7HiQYyBeCQOo+VoaSACEIlAZJRjoOo5DJGGQILlQJqyYrpaAxIgkEJuTqGoQaXgle53PJeLpXW5Nez9P7AMBwK7bbaqeTyXa+e' + 
	'DtJhif4cXjIMhyLI8UxXEKOL7jDSYPgqK48QhCEJQPQ9EyXJqnahoemCeRXBZ+aqxbBsCwCep0YBeNr3HaNaz3PK/brtWxMDpeA5IYhhF7WdZFR4tMrOdAtHL9FyPJ5T' + 
	'FicgXnoTAKAsRpHPeVhrAUd4LkmY5yj+fQ+i8L4zk+Y5vjCe4oD6ZoNhSRxiisVRKg+T5vnWfB6h6J5yAIf4fieWJFHyHZHHSTAygyAociMKBKEKBIeCiCZyHYFAnCAB' + 
	'4mBeBQJlgRIegOCgYCySAgh2WAkgINAMmMNIgCcCYoGYLoLmKaIshqCgMliEICgmDRDEiUQmkmAhWDCD5inicIVg4TQYloJg2g2ExYhoJZJEidIThMCQSFyEwkGKaRKF' + 
	'EJQJBkOhLCUJIDFoRiKBmBJhDeDZZDoPAlgmQhghaGZimmHhphqZopDoYw3GYEgFgGHROGOFJkCSSQCDoTAkiSaQ6C6IBJFkPIUCSJ5CDoeQ5CcVZ5gWHROmONJsCMSI' + 
	'SByEFyjIRoYiaKYaG6HonEiOhcguJQIHoRJsh0WBWB2JIpiqShKi0OwqnqRouiyTpGhGBxiYIZKOhqGp2j4aRaAqZL3FAECAgA==');
	end;
	set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropBefore,$1000000);
	set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropAfter,$2000000);
	set_Background(EXGRIDLib.BackgroundPartEnum.exDragDropForeColor,$10000);
	EndUpdate();
end
911
How can I sort by two-columns, one by date and one by time

with AxGrid1 do
begin
	BeginUpdate();
	SingleSort := False;
	with Columns do
	begin
		(Add('Index') as EXGRIDLib.Column).FormatColumn := '1 index ``';
		(Add('Date') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortDate;
		with (Add('Time') as EXGRIDLib.Column) do
		begin
			SortType := EXGRIDLib.SortTypeEnum.SortTime;
			FormatColumn := 'time(value)';
		end;
	end;
	with Items do
	begin
		h := AddItem(TObject(0));
		CellValue[TObject(h),TObject(1)] := '1/1/2001';
		CellValue[TObject(h),TObject(2)] := '1/1/2001 10:00:00 AM';
		h := AddItem(TObject(0));
		CellValue[TObject(h),TObject(1)] := '12/31/2000';
		CellValue[TObject(h),TObject(2)] := '1/1/2001 10:00:00 AM';
		h := AddItem(TObject(0));
		CellValue[TObject(h),TObject(1)] := '1/1/2001';
		CellValue[TObject(h),TObject(2)] := '1/1/2001 6:00:00 AM';
		h := AddItem(TObject(0));
		CellValue[TObject(h),TObject(1)] := '12/31/2000';
		CellValue[TObject(h),TObject(2)] := '1/1/2001 8:00:00 AM';
		h := AddItem(TObject(0));
		CellValue[TObject(h),TObject(1)] := '1/1/2001';
		CellValue[TObject(h),TObject(2)] := '1/1/2001 8:00:00 AM';
		h := AddItem(TObject(0));
		CellValue[TObject(h),TObject(1)] := '12/31/2000';
		CellValue[TObject(h),TObject(2)] := '1/1/2001 6:00:00 AM';
	end;
	Layout := 'multiplesort="C1:1 C2:1"';
	EndUpdate();
end
910
How can I display a context menu

// MouseUp event - Occurs when the user releases a mouse button.
procedure TWinForm1.AxGrid1_MouseUpEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseUpEvent);
begin
	with AxGrid1 do
	begin
		with (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ContextMenu')) as EXCONTEXTMENULib.ExContextMenu) do
		begin
			Items.ToString := 'Check[chk],[sep],Item 1,Item 2,Item 3';
			OutputDebugString( Select(Nil,Nil,Nil) );
		end;
	end
end;

with AxGrid1 do
begin
	ColumnAutoResize := False;
	ScrollBySingleLine := True;
	ContinueColumnScroll := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	ReadOnly := EXGRIDLib.ReadOnlyEnum.exReadOnly;
end
909
Also, are there any plans on the ability to put borders on individual cells or rows or columns

with AxGrid1 do
begin
	BeginUpdate();
	with VisualAppearance do
	begin
		Add(1,'gBFLBCJwBAEHhEJAAChABOUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgFgmEQxDANIBQSKoaQiGQYRhkEYgEiONoaDJCM4wHI' + 
	'MQxHCKTZRkGYpajOPobUbGUywHRcRRvH6EZQGWg6GjqK43SCEEZhJBNGyTJ6BZbGURbCqSLAwWZAYy2RCMRxDJqLKypSwKPoGKosS5OUwzHItaRtHaJJAwKZ6ApGQpRV' + 
	'TAYxVfC1PzkACma4nS7oXraVJFVZTdYwTh+JABTzGLpnKw7FhGa5pABpdq0RTuOZdAbPMoyXBrXqqB46UCOGg5HRWWwHR7ZIquap9JzfCq5cRbWr5BBOPaBYKwdD1CB+' + 
	'iMVRnlQRY4hafZwAMH5Pl4XQnjCEBECSIBpDGHQOicIwtBIBpmiWEIJj6eJQloEgomafgyGGCI6kKYZQH+igGAKAJgEgFgGgGYIFlCf4CmCSA2A6A5hAgRgEgQYRIFYF' + 
	'IEmEaBmBmBghigdgQgcIZogYC4ICIKB6CSCRhiiHgogWIooi4F4AmKaIaDCDBihiTg0gsIIYmYOoOmOSJ2D6AZQBAgI=');
		Add(2,'gBFLBCJwBAEHhEJAAChABdUIQAAYAQGKIaBoAKBQAGaAoDDYMg1QwAAxDGLEEwsACEIrjKCVIgkHYJRjGEZxNCMIhiGAaQChEZYHgkMomDAOEgyHKcEgJGyEQgkOa4aj' + 
	'CKYrSzAcrwTI4cRVHiQZygOZ4DBSOY8VBAcQweItJhrKqVRgriitNQjCyjZCpOaIDooAJmRZNNISBBIEQSKA0TDOQ5TSKUMYhOZTBBEbbMNBtBIUIRpajbMBiFywUxUO' + 
	'JYXhmG4dR7IMhyLI8UxXFo7P7mOZZXjmO49T7Kc70LQ9CyHJKnabpWoaXj2VZZV7Mda2DTNSzPKK1bZpG4bTouKZ5WjfN72fgeCzrF7HchyPJcXxnG4ZAMBA');
		Add(3,'gBFLBCJwBAEHhEJAAChABL0GACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgEgmEQxDANIBQSKoaQiGQYRhkEYpFiONoXDJCM4wHI' + 
	'MQxHCKTZRkGYpajOPobUbGUygBRdExvEyEZQGWg6GjqK43SCEEZhJBNGyfH6dBpEWT7ChENQwWLLFoRDIcQyXCytIDter4boGKosS5OUwzGAtaRvHaJJAwKZ6ApGQpRV' + 
	'TAYxUdC1HTjJiEa4nS7oXraVJFVZTdYwTh+JABTzGKbsSycKqWaqkABZeoWbTuOZdAbPMoyXBrXgOLYzUCOGg5HRWWwHR7ZIq0Pg9Hqaa4bVbIVxbcAGH6BQa6J5hEBE' + 
	'CSIBpDGHQOicIwtBIBpmhqEIJj2eJQloEgokiegyGGCI6kKZ5BnefA+D8L4flOa52nufg+g+f5fnPFB/ooBZ1omSAWASAJgGgJgJgIIIoDYAIDCCaBFnuBAhCgOgUgUY' + 
	'IoF4GIBiGKBuAcfohmgNgdggX54g4JB/F+GImCqCpikiNguguUAQICA=');
		Add(4,'gBFLBCJwBAEHhEJAAChABBUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgCgmEQxDANMiwGKoaQiGQYRhkEYgFiONoaDJCM4wHI' + 
	'MQxHCKTZRkGYpajOPobUbAYQQSAkEgpECbZqoEZaDoaOorTZINJ0VR1Ox5KKfZyGURZPqOEQ1DBZEI2RZUbxDJquLhACj7AjeZZtRJZVp2TY9eQ3LC3aYhGqwAwSFpJV' + 
	'jUEBgRBJIDSMY6DpOIxaEgNZpwEITOTxUK0EhRLy5agDCJ1QrCdanahqOpaXpmW5dV7YNh2LTnfzXNq3bhuO5bXqOd59X7fN54Dg+D4LRLHbpxXIcXqvFaZZDnOb4ToP' + 
	'EuAZUmqcB2B2DoHGuN5Tm6d46lsPwfhOS5mnOeg9DqCAIICA');
	end;
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exGroupLinesAtRoot;
	SelBackColor := BackColor;
	SelForeColor := ForeColor;
	DefaultItemHeight := 22;
	Columns.Add('');
	(Columns.Add('') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellBackColor] := TObject(33554432);
	Columns.Add('');
	with Items do
	begin
		h := AddItem('Root 1');
		ItemBackColor[h] := $1000000;
		hx := SplitCell[TObject(h),TObject(0)];
		CellValue[TObject(0),TObject(hx)] := 'count(current,dir,1)';
		CellValueFormat[TObject(0),TObject(hx)] := EXGRIDLib.ValueFormatEnum.exTotalField;
		FormatCell[TObject(0),TObject(hx)] := '''Childs: '' + value';
		CellBackColor[TObject(0),TObject(hx)] := $3000000;
		CellHAlignment[TObject(0),TObject(hx)] := EXGRIDLib.AlignmentEnum.CenterAlignment;
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		ExpandItem[h] := True;
		h := AddItem('Root 2');
		ItemBackColor[h] := $4000000;
		hx := SplitCell[TObject(h),TObject(0)];
		CellValue[TObject(0),TObject(hx)] := 'count(current,dir,1)';
		CellValueFormat[TObject(0),TObject(hx)] := EXGRIDLib.ValueFormatEnum.exTotalField;
		FormatCell[TObject(0),TObject(hx)] := '''Childs: '' + value';
		CellBackColor[TObject(0),TObject(hx)] := $3000000;
		CellHAlignment[TObject(0),TObject(hx)] := EXGRIDLib.AlignmentEnum.CenterAlignment;
		InsertItem(h,Nil,'Child 1');
		InsertItem(h,Nil,'Child 2');
		InsertItem(h,Nil,'Child 3');
		ItemBackColor[InsertItem(h,Nil,'Child 4')] := $4000000;
	end;
	EndUpdate();
end
908
How can I decode the Layout property
with AxGrid1 do
begin
	BeginUpdate();
	with Columns do
	begin
		Add('C1');
		(Add('C2') as EXGRIDLib.Column).Position := 1;
	end;
	with Items do
	begin
		CellValue[TObject(AddItem('SubItem 1.1')),TObject(1)] := 'SubItem 1.2';
		CellValue[TObject(AddItem('SubItem 2.1')),TObject(1)] := 'SubItem 2.2';
	end;
	Columns.Item['C2'].SortOrder := EXGRIDLib.SortOrderEnum.SortDescending;
	EndUpdate();
	OutputDebugString( 'Encoded:' );
	OutputDebugString( Layout );
	with (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.Print')) as EXPRINTLib.Print) do
	begin
		OutputDebugString( 'Decoded: ' );
		OutputDebugString( Decode64TextW[AxGrid1.Layout] );
	end;
end
907
No new line is shown if using <br> tag. How can I show a new line with-in the cell

with AxGrid1 do
begin
	BeginUpdate();
	ScrollBySingleLine := True;
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	with (Columns.Add('Single-Line') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(True);
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
	end;
	with (Columns.Add('Multiple-Lines') as EXGRIDLib.Column) do
	begin
		Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
		Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1);
	end;
	with Items do
	begin
		CellValue[TObject(AddItem('First-Line<br>Second-Line')),TObject(1)] := 'First-Line<br>Second-Line';
		h := AddItem('First-Line<br>Second-Line<br>Third-Line');
		CellSingleLine[TObject(h),Nil] := EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap;
		CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.CenterAlignment;
		ItemDivider[h] := 0;
	end;
	EndUpdate();
end
906
I am using exCRD to layout the columns in the grid, but is there a way where I can have the text in a cell wrap if it's exceeds the width of the cell instead of showing the ...'s

with AxGrid1 do
begin
	BeginUpdate();
	DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines;
	DefaultItemHeight := 36;
	FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel;
	with Columns do
	begin
		with (Add('Column1') as EXGRIDLib.Column) do
		begin
			Visible := False;
			Editor.EditType := EXGRIDLib.EditTypeEnum.EditType;
		end;
		with (Add('Column2') as EXGRIDLib.Column) do
		begin
			Visible := False;
			Editor.EditType := EXGRIDLib.EditTypeEnum.EditType;
		end;
		with (Add('Column3') as EXGRIDLib.Column) do
		begin
			Visible := False;
			Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False);
			Editor.EditType := EXGRIDLib.EditTypeEnum.EditType;
		end;
		with (Add('Column4') as EXGRIDLib.Column) do
		begin
			Alignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
			HeaderAlignment := EXGRIDLib.AlignmentEnum.CenterAlignment;
			Visible := False;
			Def[EXGRIDLib.DefColumnEnum.exCellHasButton] := TObject(True);
			Def[EXGRIDLib.DefColumnEnum.exCellButtonAutoWidth] := TObject(True);
		end;
		with (Add('FormatLevel') as EXGRIDLib.Column) do
		begin
			FormatLevel := '(0/1),"Information to be shown on the control''s header"[a=17][ww]:128,3:128';
			Def[EXGRIDLib.DefColumnEnum.exCellFormatLevel] := '(0/1),2[a=17][ww]:128,3:128';
		end;
	end;
	with Items do
	begin
		h := AddItem('Cell 1.1');
		CellValue[TObject(h),TObject(1)] := 'Cell 1.2';
		CellValue[TObject(h),TObject(2)] := 'This is just a bit of information on first row';
		CellValue[TObject(h),TObject(3)] := 'Cell 1.4';
		CellSingleLine[TObject(h),TObject(3)] := EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap;
		h := AddItem('Cell 2.1');
		CellValue[TObject(h),TObject(1)] := 'Cell 2.2';
		CellValue[TObject(h),TObject(2)] := 'This is just a bit of information on second row';
		CellValue[TObject(h),TObject(3)] := 'Cell 2.4';
	end;
	EndUpdate();
end
905
How can I load pictures using URL ( http:// )
with AxGrid1 do
begin
	http := (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.HTTP')) as EXHTTPLib.HTTP);
	PictureDisplay := EXGRIDLib.PictureDisplayEnum.LowerRight;
	(GetOcx() as EXGRIDLib.Grid).Picture := (http.GETImage['http://mail.exontrol.com/images/exontrol.png'] as Object);
end
904
How can I filter programmatically by multiple columns
with AxGrid1 do
begin
	BeginUpdate();
	with Columns do
	begin
		Add('Name');
		with (Add('Active') as EXGRIDLib.Column) do
		begin
			Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
			DisplayFilterButton := True;
		end;
		Add('Type');
		(Add('Mode') as EXGRIDLib.Column).FilterType := EXGRIDLib.FilterTypeEnum.exFilter;
	end;
	with Items do
	begin
		h := AddItem('Item A');
		CellState[TObject(h),TObject(1)] := 1;
		CellValue[TObject(h),TObject(2)] := 'A';
		h := AddItem('Item B');
		CellState[TObject(h),TObject(1)] := 0;
		CellValue[TObject(h),TObject(2)] := 'B';
		h := AddItem('Item C');
		CellState[TObject(h),TObject(1)] := 1;
		CellValue[TObject(h),TObject(2)] := 'C';
		CellValue[TObject(h),TObject(3)] := 'None';
		h := AddItem('Item D');
		CellState[TObject(h),TObject(1)] := 1;
		CellValue[TObject(h),TObject(2)] := 'C';
	end;
	with Columns.Item[TObject(1)] do
	begin
		FilterType := EXGRIDLib.FilterTypeEnum.exCheck;
		Filter := 1;
	end;
	with Columns.Item[TObject(2)] do
	begin
		FilterType := EXGRIDLib.FilterTypeEnum.exFilter;
		Filter := 'C';
	end;
	with Columns.Item[TObject(3)] do
	begin
		FilterType := EXGRIDLib.FilterTypeEnum.exNonBlanks;
	end;
	ApplyFilter();
	EndUpdate();
end
903
How can I add Right-To-Left Reading-Order / RTL Layout
with AxGrid1 do
begin
	BeginUpdate();
	TreeColumnIndex := -1;
	with (Columns.Add('RTL - Header Caption') as EXGRIDLib.Column) do
	begin
		HeaderAlignment := EXGRIDLib.AlignmentEnum($20000 Or Integer(EXGRIDLib.AlignmentEnum.RightAlignment));
		Alignment := EXGRIDLib.AlignmentEnum($20000 Or Integer(EXGRIDLib.AlignmentEnum.RightAlignment));
	end;
	FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel;
	with Items do
	begin
		AddItem('RTL - Text Right');
		CellHAlignment[TObject(AddItem('RTL - Text Center')),TObject(0)] := EXGRIDLib.AlignmentEnum($20000 Or Integer(EXGRIDLib.AlignmentEnum.CenterAlignment));
		CellHAlignment[TObject(AddItem('RTL - Text Left')),TObject(0)] := EXGRIDLib.AlignmentEnum($20000);
	end;
	EndUpdate();
end
902
I have applied ebn to the grid using the following code, and noticed that it applies to the filter dropdownList too. Is there a way to prevent this behavior, like keeping the Filter dropdownlist intact

with AxGrid1 do
begin
	VisualAppearance.Add(1,'c:\exontrol\images\normal.ebn');
	Appearance := EXGRIDLib.AppearanceEnum($1000000);
	(GetOcx() as EXGRIDLib.Grid).BackColorHeader := $1000000;
	set_Background(EXGRIDLib.BackgroundPartEnum.exBackColorFilter,$8000000f);
	(Columns.Add('Filter') as EXGRIDLib.Column).DisplayFilterButton := True;
	with Items do
	begin
		AddItem('Item 1');
		AddItem('Item 2');
	end;
end
901
The tree lines from the group parent to its children are missing and no identation is present: the parent and all its children are on the same offset from left. What canbe done

// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TWinForm1.AxGrid1_AddGroupItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddGroupItemEvent);
begin
	with AxGrid1 do
	begin
		with Items do
		begin
			nGroupColumn := GroupItem[e.item];
			ItemDivider[e.item] := -1;
			FormatCell[TObject(e.item),TObject(0)] := FormatCell[TObject(e.item),TObject(nGroupColumn)];
			CellValue[TObject(e.item),TObject(0)] := TObject(AxGrid1.Columns.Item[TObject(nGroupColumn)].GroupByTotalField);
			CellValueFormat[TObject(e.item),TObject(0)] := CellValueFormat[TObject(e.item),TObject(nGroupColumn)];
		end;
	end
end;

with AxGrid1 do
begin
	BeginUpdate();
	ReadOnly := EXGRIDLib.ReadOnlyEnum.exReadOnly;
	ColumnAutoResize := False;
	rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset);
	with rs do
	begin
		Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil);
	end;
	DataSource := (rs as ADODB.Recordset);
	SortBarVisible := True;
	SortBarCaption := 'Drag a <b>column</b> header here to group by that column.';
	AllowGroupBy := True;
	with Columns.Item[TObject(0)] do
	begin
		AllowGroupBy := False;
		Width := 96;
	end;
	Columns.Item[TObject(1)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending;
	LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot;
	EndUpdate();
end